#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from django.urls import path, re_path
from rest_framework.routers import DefaultRouter

from . import views

app_name = 'opt'
# admin 123456
urlpatterns = [
    path("apis/", views.BookApiView.as_view()),
    re_path("apis/(?P<pk>\d+)/", views.BookInfoApiView.as_view()),
    path("apis2/", views.BookGenericApiView.as_view()),
    re_path("apis2/(?P<pk>\d+)/", views.BookInfoGenericApiView.as_view()),
    path("apis3/", views.BookRetrieveApiView.as_view()),
    re_path("apis3/(?P<pk>\d+)/", views.BookInfoRetrieveApiView.as_view()),
    path("apis4/", views.BookGenericeApiView.as_view()),
    re_path("apis4/(?P<pk>\d+)/", views.BookInfoGenericeApiView.as_view()),
]

router = DefaultRouter()
# 2、给路由注册视图集
router.register("apis5", views.BookModelViewSetApiView, basename="apis5")  # 不能用正则
urlpatterns += router.urls
